<template>
  <a-modal
    title="查看"
    v-model="show"
    :maskClosable="false"
    :width="1050"
    placement="right"
    :closable="true"
    @cancel="onClose"
    :footer="null"
    :visiable="reconPathInfoInfoVisiable"
  >
    <a-form :form="form">
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label="交易链路编号"
                       v-bind="formItemLayout">
            <a-input v-decorator="['txnChainCode',{rules: [{ required: true, message: '必填' }]}]" :disabled="true"/>
          </a-form-item>
          <a-form-item label="id" style="display: none">
            <a-input type="hidden" name="id" v-decorator="['id']"/>
          </a-form-item>
        </a-col>
        <a-col :md="12" :sm="24">
          <a-form-item label='交易链路描述'
                       v-bind="formItemLayout">
            <a-input v-decorator="['txnChainDesc',{rules: [{ required: true, message: '必填' }]}]" :disabled="true"/>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label="对账截止时间"
                       v-bind="formItemLayout">
            <a-input v-decorator="['reconDeadline',{rules: [{ required: true, message: '必填' }]}]" :disabled="true"/>
          </a-form-item>
        </a-col>
        <a-col :md="12" :sm="24">
          <a-form-item label='是否参与对账'
                       v-bind="formItemLayout">
            <a-select
              mode="default"
              :allowClear="true"
              style="width: 100%"
              v-decorator="['reconFlag',{rules: [{ required: true, message: '必填' }]}]" :disabled="true">
              <a-select-option key="Y">参与</a-select-option>
              <a-select-option key="N">不参与</a-select-option>
            </a-select>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label="基准系统"
                       v-bind="formItemLayout">
            <a-input v-decorator="['reconStandSysId',{rules: [{ required: true, message: '必填' }]}]":disabled="true"/>
          </a-form-item>
        </a-col>
        <a-col :md="12" :sm="24">
          <a-form-item label='对账场景'
                       v-bind="formItemLayout">
            <a-select mode="default"
                      :allowClear="true"
                      style="width: 100%"
                      v-decorator="['reconSceneId']" :disabled="true">
              <a-select-option v-for="r in instIdData" :key="r.label">{{r.label}}-{{r.value}}</a-select-option>
            </a-select>
          </a-form-item>
        </a-col>
        <a-col :md="12" :sm="24">
          <a-form-item label='交易路径'
                       v-bind="formItemLayout">
            <a-input v-decorator="['txnChainPath',{rules: [{ required: true, message: '必填' }]}]" :disabled="true"/>
          </a-form-item>
        </a-col>
        <a-col :md="12" :sm="24">
          <a-form-item label='承兑路径'
                       v-bind="formItemLayout">
            <a-input v-decorator="['acceptChainPath',{rules: [{ required: true, message: '必填' }]}]" :disabled="true"/>
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :md="12" :sm="24">
          <a-form-item label='审批意见'
                       v-bind="formItemLayout">
            <a-input v-decorator="['auditRefuseReason']"/>
          </a-form-item>
        </a-col>
      </a-row>
      <br>

    </a-form>
  </a-modal>
</template>

<script>
  import ACol from "ant-design-vue/lib/grid/Col";
  const formItemLayout = {
    labelCol: {span: 8},
    wrapperCol: {span: 16}
  }
  export default {
    name: "ReconPathInfoInfo",
    components: {ACol},
    props:{
      reconPathInfoInfoVisiable:{
        default:false
      },

    },
    data(){
      return{
        formItemLayout,
        form: this.$form.createForm(this),
        validateStatus: '',
        //
        reconPathInfo: {
          txnChainCode: '',
          instId: '',
          flag: ''
        },
        instIdData: [],
      }
    },
    computed: {
      show: {
        get: function () {
          return this.reconPathInfoInfoVisiable
        },
        set: function () {
        }
      }
    },

    methods:{
      reset() {
        this.loading = false
        this.form.resetFields()
      },
      onClose() {
        this.reset()
        this.$emit('close')
      },
      setReconPathFields() {
        let values = this.form.getFieldsValue(['id','txnChainCode', 'txnChainDesc', 'reconDeadline',
          'reconFlag', 'reconStandSysId', 'reconSceneId', 'txnChainPath',
          'acceptChainPath'])
        if (typeof values !== 'undefined') {
          Object.keys(values).forEach(_key => {
            this.reconPathInfo[_key] = values[_key]
          })
        }
      },

      setReconPathFormValues({...reconPath}) {
        let fields =['id','txnChainCode', 'txnChainDesc', 'reconDeadline',
          'reconFlag', 'reconStandSysId', 'reconSceneId', 'txnChainPath',
          'acceptChainPath']
        Object.keys(reconPath).forEach((key) => {
          if (fields.indexOf(key) !== -1) {
            this.form.getFieldDecorator(key)
            let obj = {}
            obj[key] = reconPath[key]
            this.form.setFieldsValue(obj)
          }
        })
      },
    }
  }
</script>

<style scoped>

</style>
